import request from '@/apis/request';
import { GENERAL_REMOTE_OPTIONS } from '@/constants';
// 根据下拉框类型和项目所属获取下拉框数据
const findBySelectNameDefaultUrl = '/child/CommonDropoptionControl/findBySelectNameDefault';
// 各列表接口路径
const welfareorgsGetWelfareOrgsList = '/child/welfareorgs/getWelfareOrgsList';
const newChildEvaluatesGetReportList = '/child/newChildEvaluates/getReportList';

/**
 * 通用查询
 * @param data
 * @returns
 */
export const commonGetDataApi = (data?: object) => {
    return request(
        {
            url: '/child/common/getData',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 通用保存
 * @param data
 * @returns
 */
export const commonSaveDataApi = (data?: object) => {
    return request(
        {
            url: '/child/common/saveData',
            method: 'post',
            data,
        },
        true,
        true
    );
};
/**
 * 通用接口文档
 * @param data
 * @returns
 */
export const commonGetCommonDocListApi = (data?: object) => {
    return request(
        {
            url: '/child/common/getCommonDocList',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// login 登录接口
export const doLoginApi = (data?: object) => {
    return request(
        {
            url: '/child/child/login/doLogin',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 根据下拉框类型和项目所属获取下拉框数据
export const getUploadImageApi = (
    url?: string,
    data?: object,
    isLoading: boolean = false,
    isShowErrToast: boolean = true
) => {
    return request(
        {
            url,
            method: 'post',
            data,
        },
        isLoading,
        isShowErrToast
    );
};
// 行政区划
export const getCityOptionApi = (data?: object) => {
    return request(
        {
            url: '/child/childCity/getChildCityList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// excel公共导出

export const customizeExportApi = (data?: object, url?: string) => {
    return request(
        {
            // url: '/child/childExcelExport' + url + '/customizeExport',
            url: url + '/customizeExport',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 福利机构列表导出
export const welfareorgsGetWelfareOrgsListCustomizeExportApi = (data?: object) => {
    return customizeExportApi(data, welfareorgsGetWelfareOrgsList);
};
// 风险等级列表导出
export const newChildEvaluatesGetReportListCustomizeExportApi = (data?: object) => {
    return customizeExportApi(data, newChildEvaluatesGetReportList);
};

// 默认的字典查询
export const findBySelectNameDefaultApi = (data?: object) => {
    return request(
        {
            url: findBySelectNameDefaultUrl,
            method: 'post',
            data,
        },
        false,
        true
    );
};
// let findBySelectNameDefaultApis = new Array(GENERAL_REMOTE_OPTIONS.length);
// for (let i = 0; i < GENERAL_REMOTE_OPTIONS.length; i++) {
//     findBySelectNameDefaultApis[i] = (data?: object) => {
//         return request({
//             url: findBySelectNameDefaultUrl,
//             method: 'post',
//             data: {
//                 name: GENERAL_REMOTE_OPTIONS[i].name
//             }
//         },false, true);
//     }
// }
// export const findBySelectNameDefault0Api = findBySelectNameDefaultApis[0]
// export const findBySelectNameDefault1Api = findBySelectNameDefaultApis[1]

// 福利机构
// 福利机构列表
export const welfareorgsGetWelfareOrgsListApi = (data?: object) => {
    return request(
        {
            url: welfareorgsGetWelfareOrgsList,
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 查看福利机构信息
export const welfareorgsGetWelfareOrgsInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/welfareorgs/getWelfareOrgsInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 新增更新福利机构
export const welfareorgsAddChildInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/welfareorgs/addChildInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 机构儿童
// 机构儿童列表
export const welfareorgsGetOrphansListApi = (data?: object) => {
    return request(
        {
            url: '/child/welfareorgs/getOrphansList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 机构儿童信息
export const welfareorgsGetOrphansDetailApi = (data?: object) => {
    return request(
        {
            url: '/child/welfareorgs/getOrphansDetail',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 四色管理 评估记录列表
 * @param data
 * @returns
 */
export const newChildEvaluatesGetReportListApi = (data?: object) => {
    return request(
        {
            url: newChildEvaluatesGetReportList,
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 风险等级查看评估报告打印
export const childEvaluateGetReportPdfApi = (data?: object) => {
    return request(
        {
            url: '/social/childEvaluate/getReportPdf',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 流动儿童
// 流动儿童对象管理列表
export const flowChildGetFlowChildListApi = (data?: object) => {
    return request(
        {
            url: '/child/flowChild/getFlowChildList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 流动儿童注销流动儿童信息
export const flowChildDeleteFlowChildInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/flowChild/deleteFlowChildInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 流动儿童查看流动儿童信息
export const flowChildGetFlowChildInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/flowChild/getFlowChildInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 流动儿童保存更新流动儿童信息
export const flowChildSaveFlowChildInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/flowChild/saveFlowChildInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
/**
 * 困境儿童 流动儿童 统计分析
 * @param data
 * @returns
 */
export const flowChildCountApi = (data?: object) => {
    return request(
        {
            url: '/child/flowChild/count',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 留守儿童
// 留守儿童注销留守儿童信息
export const leftBehindChildrenDeleteLeftBehindChildrenInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/deleteLeftBehindChildrenInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 查看留守儿童信息
export const leftBehindChildrenGetLeftBehindChildrenInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/getLeftBehindChildrenInfo',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 留守儿童 申请审批列表
 * @param data
 * @returns
 */
// 获取留守儿童信息列表(留守儿童-对象管理)
export const leftBehindChildrenGetChildApplicationListApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/getChildApplicationList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 留守儿童 对象管理列表
 * @param data
 * @returns
 */
export const leftBehindChildrenGetLeftBehindChildrenListApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/getLeftBehindChildrenList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 留守儿童 统计分析列表
 * @param data
 * @returns
 */
export const leftBehindChildrenCountApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/count',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 获取留守儿童信息列表(留守儿童-监护监督)
export const leftBehindChildrenGetLeftGuardianshipSupervisionListApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/getLeftGuardianshipSupervisionList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 留守儿童委托照护责任确认书pdf查看
export const leftBehindChildrenGetLiabilityPdfApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/getLiabilityPdf',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 保存更新留守儿童信息
export const leftBehindChildrenSaveLeftBehindChildrenInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/saveLeftBehindChildrenInfo',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 留守儿童委托照护责任确认书pdf新增修改
export const leftBehindChildrenSaveLiabilityPdfApi = (data?: object) => {
    return request(
        {
            url: '/child/leftBehindChildren/saveLiabilityPdf',
            method: 'post',
            data,
        },
        false,
        true
    );
};

// 困境儿童
// 困境儿童列表 过期
export const difficultyChildGetChildListApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/getChildList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 困境儿童列表
export const childApplyGetDilemmaChildListApi = (data?: object) => {
    return request(
        {
            url: '/child/childApply/getDilemmaChildList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 查看困境儿童信息
export const difficultyChildGetChildDetailInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/getChildDetailInfo',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 保存困境儿童信息
export const newChildSaveEavluateChildInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/newChild/saveEavluateChildInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 变更困境儿童信息
export const newChildChangeEavluateChildInfoApi = (data?: object) => {
    return request(
        {
            url: '/child/newChild/changeEavluateChildInfo',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 注销困境儿童信息
export const newChildCancelChildApi = (data?: object) => {
    return request(
        {
            url: '/child/newChild/cancelChild',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 困境儿童政策计算
export const difficultyChildCountChildTypeApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/countChildType',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 困境儿童审核
export const childApplyChildSubmitApprovalApi = (data?: object) => {
    return request(
        {
            url: '/child/childApply/childSubmitApproval',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 困境儿童审批
export const childApplyChildSubmitCloseApi = (data?: object) => {
    return request(
        {
            url: '/child/childApply/childSubmitClose',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 困境儿童资金管理保障标准设置列表
export const difficultyChildGetChildBenefitListApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/getChildBenefitList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 困境儿童资金管理发放管理创建资金发放
export const difficultyChildApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/createFundRelease',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 困境儿童资金管理发放管理列表
export const difficultyChildGetFundReleaseMainListApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/getFundReleaseMainList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 困境儿童资金管理发放管理查看列表
export const difficultyChildGetFundReleaseSubListApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/getFundReleaseSubList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 困境儿童资金管理发放管理删除资金发放
export const difficultyChildDeleteFundReleaseApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/deleteFundRelease',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 困境儿童资金管理发放管理重新发放
export const difficultyChildAfreshOneFundReleaseApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/afreshOneFundRelease',
            method: 'post',
            data,
        },
        true,
        true
    );
};
/**
 * 困境儿童 资金管理 月度汇总统计列表
 * @param data
 * @returns
 */
export const difficultyChildGetChildMonthCountApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/getChildMonthCount',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 困境儿童 资金管理 年度汇总统计列表
 * @param data
 * @returns
 */
export const difficultyChildGetChildYearCountApi = (data?: object) => {
    return request(
        {
            url: '/child/difficultyChild/getChildYearCount',
            method: 'post',
            data,
        },
        false,
        true
    );
};

// 工作人员走访
// 工作人员走访批次；一年两查；一月一访问列表
export const childTaskGetBatchListApi = (data?: object) => {
    return request(
        {
            url: '/child/childTask/getBatchList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 工作人员走访任务列表
export const childTaskGetRecordListApi = (data?: object) => {
    return request(
        {
            url: '/child/childTask/getRecordList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 工作人员走访 走访任务详情
 * @param data
 * @returns
 */

export const childTaskGetGetRecordDetailApi = (data?: object) => {
    return request(
        {
            url: '/child/childTask/getRecordDetail',
            method: 'post',
            data,
        },
        true,
        true
    );
};
/**
 * 工作人员走访 工作人员走访批次 批次开始
 * @param data
 * @returns
 */
export const childTaskStartBatchApi = (data?: object) => {
    return request(
        {
            url: '/child/childTask/startBatch',
            method: 'post',
            data,
        },
        true,
        true
    );
};
/**
 * 工作人员走访 工作人员走访批次 批次完成
 * @param data
 * @returns
 */
export const childTaskFinishBatchApi = (data?: object) => {
    return request(
        {
            url: '/child/childTask/finishBatch',
            method: 'post',
            data,
        },
        true,
        true
    );
};
/**
 * 工作人员走访 工作人员走访批次 批次删除
 * @param data
 * @returns
 */
export const childTaskDeleteBatchApi = (data?: object) => {
    return request(
        {
            url: '/child/childTask/deleteBatch',
            method: 'post',
            data,
        },
        true,
        true
    );
};
// 项目管理
// 项目开发列表
export const childActivityListApi = (data?: object) => {
    return request(
        {
            url: '/child/childActivity/list',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 活动管理列表
export const childActivityItemListApi = (data?: object) => {
    return request(
        {
            url: '/child/childActivity/itemList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 工作管理
// 人员管理列表
export const childUserListApi = (data?: object) => {
    return request(
        {
            url: '/child/user/list',
            method: 'post',
            data,
        },
        false,
        true
    );
};
// 儿童数据同步
// 儿童数据同步列表
export const syncStChildGetListApi = (data?: object) => {
    return request(
        {
            url: '/child/syncStChild/getList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
/**
 * 四色管理 风险等级列表
 * @param data
 * @returns
 */
export const newChildEvaluatesGetRiskListApi = (data?: object) => {
    return request(
        {
            url: '/child/newChildEvaluates/getRiskList',
            method: 'post',
            data,
        },
        false,
        true
    );
};
